Ext.define('appmod.view.knowledge.content.BindingColligationForm', {
    extend: 'Ext.form.Panel',
    alias: ['widget.knowledge.content.bindingcolligationform', 'widget.knowledge-content-bindingcolligationform'],
    requires: ['Ext.ux.form.MultiSelect', 'Ext.ux.form.field.GridComboBox' , 'appmod.model.SelectItemModel'],
    bodyPadding: 10,
    
    constructor: function(config){
    
        if (config.fieldStores) {
            this.fieldStores = config.fieldStores;
        }
        this.callParent(arguments);
    },
    
    initComponent: function(){
        var me = this;

		
		
		var emptyDs = Ext.create('Ext.data.Store', {
        	autoDestroy: true,
        	model: 'appmod.model.SelectItemModel',
        	data: []
    	})
        
		var stores = me.fieldStores;
		
		dsKm = stores['dsColligation'];
        
        Ext.applyIf(me, {
            fieldDefaults: {
                labelWidth: 80
            },
            autoScroll: true,
            items: [{
                xtype: 'hiddenfield',
                name: 'id',
                anchor: '100%'
            }, {
                height: 250,
                xtype: 'multiselect',
                name: 'selectedAttachment',
                anchor: '95%',
                fieldLabel: '附件',
                store: emptyDs,
                displayField: 'name',
                valueField: 'id',
                msgTarget: 'side'
            }, {
                xtype: 'gridcombobox',
                multiSelect: false,
                name: 'colligationId',
                anchor: '95%',
				displayField : 'title',
				valueField : 'id',				
				store:dsKm,
                typeAhead: true,
                queryMode: 'remote',
                fieldLabel: '知识点',
                gridCfg: {
                    store: dsKm,
                    height: 200,
                    width: 400,
                    columns: [{
                        text: '主题',
                        width: 40,
                        dataIndex: 'title'
                    }, {
                        text: '内容',
                        width: 120,
                        dataIndex: 'content'
                    }, {
                        text: '访问级别',
                        width: 60,
                        dataIndex: 'shared',
						trueText:'公开',
						falseText:'私有'						
                    }]
                }
            }]
        });
        
        me.callParent(arguments);
    }
    
});
